
package org.alex.mqtt.common.bus.model;

import lombok.Data;
import org.alex.mqtt.common.bus.enums.MessageSourceEnum;

import java.util.Date;
import java.util.Map;

@Data
public class DeviceMessage {

    private Long id;

    private byte[] content;

    private MessageSourceEnum source;

    private String fromClientId;

    private Date storedTime;

    private String topic;

    private Map<String,Object> properties;

    public <T> T  getProperty(String key){
        if (properties == null || properties.containsKey(key)) {
            return (T) properties.get(key);
        }
        return null;
    }
}
